package com.dianzhihan.http1;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class FirstController {
    @GetMapping("/first-dynamic-resource")
    @ResponseBody
    public String demo(
            // Request 请求   Param 是 Parameter 的缩写，意思是参数
            @RequestParam(value = "name", required = false) String name,
            @RequestParam(value = "age", required = false) String age
    ) {
        System.out.println("请求参数 name = " + name);
        System.out.println("请求参数 age = " + age);

        System.out.println("这里执行了: name = |" + name + "|, age = |" + age + "|");
        return "<h1>我是动态资源</h1>name = |" + name + "|, age = |" + age + "|";
    }
}
